import torchaudio

wav_path = "D:\FFOutput\哭声.wav"
wav, sr = torchaudio.load(wav_path)
print(wav.shape)
print(sr)
# 吧音频重新采样为16000Hz
wav = torchaudio.transforms.Resample(sr, 16000)(wav)
print(wav.shape)
# 将wav分割蹭你10份，分别保存为D:\FFOutput\哭声10_1.wav 和D:\FFOutput\哭声10_2.wav, 等等
sample_num = wav.shape[1]
for i in range(10):
    start = i * sample_num // 10
    end = (i + 1) * sample_num // 10
    torchaudio.save(f"D:\FFOutput\哭声{10}_{i+1}.wav", wav[:, start:end], 16000)

